package zgrjb.snbq.teach_platform.exception;

import lombok.Getter;
import zgrjb.snbq.teach_platform.enums.BizCodeEnum;

/**
 * 业务异常类
 * 用于处理业务逻辑相关的异常
 */
@Getter
public class BusinessException extends RuntimeException {

    private final BizCodeEnum bizCodeEnum;

    public BusinessException(BizCodeEnum bizCodeEnum) {
        super(bizCodeEnum.getMessage());
        this.bizCodeEnum = bizCodeEnum;
    }

    public BusinessException(BizCodeEnum bizCodeEnum, String message) {
        super(message);
        this.bizCodeEnum = bizCodeEnum;
    }

    public BusinessException(BizCodeEnum bizCodeEnum, Throwable cause) {
        super(bizCodeEnum.getMessage(), cause);
        this.bizCodeEnum = bizCodeEnum;
    }

    public BusinessException(BizCodeEnum bizCodeEnum, String message, Throwable cause) {
        super(message, cause);
        this.bizCodeEnum = bizCodeEnum;
    }
} 